﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="../scripts/boot.js" type="text/javascript"></script>
    <script type="text/javascript">
        $.ajax({
            url: "../data/system.aspx?method=1311",
            async: false,
            success: function (text) {
                if (text == "no")
                    window.location = "../system/error.html";
                else if (text == "out") {
                    var loginWindow = parent.mini.get("loginWindow");
                    if (!loginWindow.visible)
                        loginWindow.show();
                    var tabs = parent.mini.get("mainTabs");
                    var tab = tabs.getTab("tab$1311");
                    tabs.removeTab(tab);
                }
            }
        });
    </script>
</head>
<body>
    <div class="mini-toolbar" style="border-bottom: 0;">
        <table>
            <tr>
                <td>
                    专业类别：
                    <input id="type" class="mini-combobox" textField="ma_name" valueField="ma_id"
                        style="width: 150px;" url="../data/system.aspx?method=CbxMajorP" value="0"/>
                    更新日期：
                    <input id="sdate" class="mini-datepicker"/>
                    至
                    <input id="edate" class="mini-datepicker"/>
                    <a class="mini-button" iconcls="icon-search" plain="true" onclick="search();">查询</a>
                    <span class="separator"></span>
                    <a class="mini-button" plain="true" iconcls="icon-excel" onclick="excelRow()">查询结果导出</a>
                </td>
            </tr>
        </table>
    </div>
    <div class="mini-fit" >
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" allowresize="true"
            idfield="id" url="../data/system.aspx?method=SHighByMajor" sizeList="[15,20,50,100]" pageSize="15"
            showSummaryRow="true" ondrawsummarycell="onDrawSummaryCell">
            <div property="columns">
                <div type="indexcolumn"></div>
                <div field="ma_name" width="200px" headeralign="center" align="center" allowsort="true" renderer="onTypeRenderer">
                    专业类别</div>
                <div field="pi_count" width="100px" headeralign="center" align="center" allowsort="true">
                    求职人才数</div>
                <div field="pi_percent" width="100px" headeralign="center" align="center" allowsort="true" renderer="onPointRenderer">
                    所占比例</div>
            </div>
        </div>
    </div>
    <iframe id="exportIFrame" style="display:none;"></iframe>
    <!--导出Excel相关HTML-->
     <form id="excelForm" action="../data/download.aspx?method=ExcelHighByMajor" method="post" target="excelIFrame">
        <input type="hidden" name="type" id="Hidden1" />
        <input type="hidden" name="sdate" id="Hidden2" />
        <input type="hidden" name="edate" id="Hidden3" />
    </form>
    <iframe id="excelIFrame" name="excelIFrame" style="display:none;"></iframe>
    <script type="text/javascript">
        $.ajaxSetup({
            contentType: "application/x-www-form-urlencoded;charset=utf-8",
            complete: function (XMLHttpRequest, textStatus) {
                if (XMLHttpRequest.responseText == "out") {
                    var loginWindow = parent.mini.get("loginWindow");
                    if (!loginWindow.visible)
                        loginWindow.show();
                }
            }
        });

        mini.parse();

        var myDate = new Date();
        var year = myDate.getFullYear();
//        mini.get("sdate").setValue(myDate.getFullYear() + "/" + myDate.getMonth() + "/1");
//        mini.get("edate").setValue(myDate.getFullYear() + "/" + (myDate.getMonth() + 1) + "/1");
        var grid = mini.get("datagrid1");
        search();

        function search() {
            var type = mini.get("type").getValue();
            var sdate = mini.get("sdate").getText();
            var edate = mini.get("edate").getText();
            $("#Hidden1").val(type);
            $("#Hidden2").val(sdate);
            $("#Hidden3").val(edate);

            grid.load({ type: type, sdate: sdate, edate: edate });
            grid.sortBy("count(pi_no)", "desc");
            grid.gotoPage(0, grid.pager.pageSize);
        }

        function onTypeRenderer(e) {
            if (e.value == null)
                return "";
            else
                return e.value
        }

        function onPointRenderer(e) {
            if (e.value == null)
                return "0.00%";
            else
                return e.value + "%";
        }

        function onDrawSummaryCell(e) {
            var result = e.result;
            //服务端汇总计算
            if (e.field == "ma_name") {
                var s = "<span style='color:Brown;'>合计</span>";
                e.cellHtml = s;
            }

            if (e.field == "pi_count") {
                var s = "<span style='color:Brown;'>"
                s += result.personcount + "</span>";
                e.cellHtml = s;
            }

            if (e.field == "pi_percent") {
                var s = "<span style='color:Brown;'>100%</span>";
                e.cellHtml = s;
            }
        }

        function excelRow() {
            mini.confirm("确定导出求职人才统计情况吗？", "系统提示",
                function (action) {
                    if (action == "ok") {
                        $("#excelForm").submit();
                    }
                }
            );
        }
    </script>
</body>
</html>